const Vue = require('vue');
const { createRenderer } = require('vue-server-renderer');
const app = new Vue({
  template: `<div>Hello World</div>`
});

// 通过 renderToString 将 Vue 实例渲染为 HTML
// 函数签名: renderer.renderToString(vm, context?, callback?): ?Promise<string>
createRenderer().renderToString(app, (err, doc) => {
  if (err) throw err
  console.log(doc)
})